	<!-- MAIN -->
		<div class="main">
			<!-- MAIN CONTENT -->
			<div class="main-content">
				<div class="container-fluid">
					<h3 class="page-title">新闻类型</h3>
					<div class="row">
						<form action="" method="post" role=form>
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">新闻类型添加</h3>
								</div>
								<div class="panel-body">
                                
								
									<input type="text" class="form-control" name="name" placeholder="请输入标题">
									<br>
									
								   <div class="panel-body list">

									<select class="form-control select_cate" name="pid">

									<option value="0">顶级分类</option>

									<?php foreach($cate as $v){?>
									<option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
									<?php } ?>
									</select>
									
								</div>
                                     <br>
									<input class="form-control" type="submit" value="提交">
									</form>
									<!-- <select class="form-control">
										<option value="cheese">Cheese</option>
										<option value="tomatoes">Tomatoes</option>
										<option value="mozarella">Mozzarella</option>
										<option value="mushrooms">Mushrooms</option>
										<option value="pepperoni">Pepperoni</option>
										<option value="onions">Onions</option>
									</select> -->
									
						
						
							<!-- END PROGRESS BARS -->
							<!-- INPUT GROUPS -->							
	</div>
<script src="resources/assets/jquery-3.2.1.min.js"></script>
<script type="text/javascript" >


	$(function(){

		$('.list').on('change','select',function(){
                

                $(this).nextAll().remove();
			if($(this).get(0).selectedIndex==0){
				return false;
			}

	         var id = $(this).val();

	         $(this).nextAll().remove();
				    // 通过ajax获取选中类的子级数据
	              $.ajax({

	              	   type:'get',
	              	   url:'index.php?c=cate&a=add&admin=1&id='+id,
	              	   dataType:'json',
	              	   success:function(json){

	              	   	var html='';

							html+='<select class="form-control select_cate" name="pid">';
							html+='<option value="'+id+'">上一级</option>';
						for(i in json){
							html+='<option value="'+json[i].id+'">'+json[i].name+'</option>';
							}
							html+='</select>';
                           
							$('.list').append(html);
                    }
            
               })
             
			})
              
		})


</script>